package api

import (
	"2301a/live_broadcast/api/handler"
	"2301a/live_broadcast/consts"
	"github.com/gin-gonic/gin"
	jwt "github.com/golangblogs/gojwt"
)

func LoadRouter(r *gin.Engine) {
	api := r.Group("api")
	{
		user := api.Group("user")
		{
			user.POST("/register", handler.Register) //用户注册
			user.POST("/login", handler.Login)       //用户登录
			user.Use(jwt.JWTAuth(consts.JWT_KEY))
			user.POST("/refresh", handler.RefreshToken) //更新、刷新token
		}
		live := api.Group("live")
		{
			live.Use(jwt.JWTAuth(consts.JWT_KEY))
			live.POST("/add/live", handler.AddLiveRoom) //1.	创建直播间

			live.POST("/details/live", handler.DetailsLiveRoom) //2.	查询直播间

			live.POST("/modify/live", handler.ModifyLiveRoom) //3.	更新直播间

			live.POST("/delete/live", handler.DeleteLiveRoom) //4.	删除直播间

		}
	}
}
